package com.YCH.model.mappers.app;

import com.YCH.model.behavior.pojos.TbShowBehavior;
import com.YCH.model.article.vos.ArticleMonthlyHotList;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface TbShowBehaviorMapper {
    List<TbShowBehavior> selectListByUserIdAndArticleIds(@Param("userId") Long id, @Param("articleIds")Long[] articleIds);

    TbShowBehavior selectShowBehaviorByUserIdAndArticleId(@Param("userId") Long id,@Param("articleId") Long articleId);

    void saveShowBehavior(@Param("articleIds") Long[] articleIds, @Param("userId") Long userId);

    /**
     * 查询查看人数
     * @param articleId
     * @param isClick
     * @return
     */
    Integer selectViewCount(@Param("articleId") Long articleId, @Param("isClick") short isClick);

    /**
     * 点击文章触发，修改点击为true，即查看人数+1
     * @param userId
     * @param articleId
     * @param isClick
     * @return
     */
    Integer updateShowBehavior(@Param("userId")Long userId,@Param("articleId")Long articleId,@Param("isClick") Integer isClick);

    /**
     * 查询查看数量前三的文章
     * @return
     */
    List<ArticleMonthlyHotList> loadMonthHotList();
}
